var util = require('../../utils/util.js');
var app = getApp();
Page({
  data: {
      searchVal:"",
      searchResult:[]
  },
  loadMore:function(){
      if(!noMore){
        page ++;
        this.load();
      }
  },
  inputVal: function(e){
    this.setData({
      searchVal: e.detail.value
    })
  },
  onLoad: function(data){
    // uid = data.uid || "";
    var val = data.val;
    if (val) {
      this.setData({
        searchVal: val
      })
      this.search();
    }
    this.load();
  },
  load:function(){
  },
  goAtherPage: function(e){
      var url = e.currentTarget.dataset.link;
      wx.redirectTo({url: url})
  },
  search: function(){
    var that = this;
    if(!this.data.searchVal)
      return false;
    util.api({
      data: {
          "publickey": util.publiccode,
          "ac": "searchuser",
          "key": this.data.searchVal
      },
      success: function(responseData){
        that.setData({
          searchResult: responseData.data
        })
      }
    });
  }
})